/*
    project-bppc
    Copyright (C) 2011  Michal Kóňa, Petr Kačer

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


#ifndef CMAP_H
#define CMAP_H

/**
 * CMap class
 * Description ...
 *
 * @author Petr Kačer
 * @version 14/09/2011
 */

namespace stack
{

template <typename T>
class CMap
{
private:
	struct Node {
		T *item;
		int hash;
		Node *parent;
		Node *child;
	};

	static int m_TotalCounter;
	const int m_iIndex;

	Node * m_pFirst;
public:
	CMap();
	CMap (T *item, int hash);
	CMap (T **items) : m_pFirst (0) {

	}
	virtual ~CMap() {

	}

	int getIndex() const {
		return m_iIndex;
	}

	static int getTotalCounter() {
		return m_TotalCounter;
	}

};

template <typename T>
CMap<T>::CMap() : m_pFirst (0), m_iIndex (m_TotalCounter++)
{

}

template <typename T>
CMap<T>::CMap(T *item, int hash) : m_pFirst (0), m_iIndex (m_TotalCounter++)
{
	m_pFirst = new Node;
	m_pFirst->item = item;
	m_pFirst->hash = hash;
	m_pFirst->parent = 0;
	m_pFirst->child = 0;
}


template<typename T> int CMap<T>::m_TotalCounter = 0;

};


#endif // CMAP_H
